<template>
  <div class="doctor_info_box">
    <el-row>
      <el-col :span="4">
        <div class="avatar_box">
          <img v-if="doctorDetailsInfo.userPhoto" :src="doctorDetailsInfo.userPhoto">
          <img v-else src="~@/assets/images/doctor_lg.png" alt>
        </div>
      </el-col>
      <el-col :span="20">
        <div class="doctor_info">
          <div class="dc_name">{{doctorDetailsInfo.userName}}</div>
          <div class="dc_info_row">
            <div class="dc_info_label">职称：</div>
            <div class="dc_info_txt">{{doctorDetailsInfo.position | isNone}}</div>
          </div>
          <div class="dc_info_row">
            <div class="dc_info_label">特长：</div>
            <div class="dc_info_txt">{{doctorDetailsInfo.expertSpeciality | isNone}}</div>
          </div>
          <div class="dc_info_row">
            <div class="dc_info_label">简介：</div>
            <div
              class="dc_info_txt"
            >{{doctorDetailsInfo.hospitalName}}-{{doctorDetailsInfo.deptName}}-{{doctorDetailsInfo.expertSpeciality}}</div>
            <div class="dc_info_row">
              <el-button
                size="small"
                v-if="!selectDisabled"
                class="nav_save"
                type="primary"
                @click="selectedDoctor"
              >选择该医生</el-button>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  props: {
    selectDisabled: {
      type: Boolean,
      default: false
    }
    // doctorDetailsInfo: {}
  },
  filters: {
    isNone(val) {
      return val || '-'
    }
  },
  methods: {
    selectedDoctor() {
      const info = this.doctorDetailsInfo
      this.$emit('selectedDoctor', info)
    }
  }
}
</script>

<style lang="scss" scoped>
.doctor_info_box {
  .avatar_box {
    width: 60%;
    margin: 0 auto;
    img {
      display: block;
      width: 100%;
      height: auto;
    }
  }
  .doctor_info {
    .dc_name {
      font-size: 16px;
      color: #333;
      font-weight: bold;
      margin-bottom: 10px;
    }
    .dc_info_row {
      font-size: 14px;
      color: #666;
      line-height: 1.7em;
      margin: 3px 0;
      .dc_info_label {
        width: 60px;
        float: left;
      }
      .dc_info_txt {
        margin-left: 60px;
      }
      .nav_save {
        float: right;
      }
    }
  }
}
</style>
